#! /usr/bin/env python
# -*- coding: iso-8859-1 -*-

import wxoptparse
import optparse, sys, subprocess

parser = optparse.OptionParser()
parser.add_option('-f', metavar='FOLDER', dest='folder', default=".",
    help='Folder where to begin the search')
parser.add_option('--name', metavar='NAME', dest='pattern', default="*",
     help='Search for pattern')
parser.add_option('--print', dest='bPrint', action='store_true', default=True,
     help='Print output')
(options, args) = parser.parse_args()

parser.commandLineLst = [x.replace('--', '-') for x in parser.commandLineLst if x != '-f']
parser.commandLineLst.insert(0, 'find')

cmdLine = " ".join(parser.commandLineLst)
print cmdLine
try:
    retcode = subprocess.call(cmdLine, shell=True)
    if retcode < 0:
        print >>sys.stderr, "Child was terminated by signal", -retcode
    else:
        print >>sys.stderr, "Child returned", retcode
except OSError, e:
    print >>sys.stderr, "Execution failed:", e
